The invention concerns a method for decoding recorded transport streams or packetized elementary streams in a digital video system. It also concerns a device implementing this method. The invention may in particular be applied to trickmode decoding.
An MPEG II or DVB compliant digital television stream comprises several layers, among which the elementary stream layer, the Packetized Elementary Stream (PES) layer and the Transport Stream (TS) layer. A corresponding decoder usually comprises a demultiplexer for filtering certain TS layer packets, a PES Parser for removing the PES layer and transferring the original elementary streams and at least a video decoder for decoding the video elementary stream.
Future decoders will incorporate mass storage devices in order to record compressed TS or PES streams. In order to implement trickmodes, such as slow or fast forward or backward play, the video stream needs to be edited before being transferred from the mass storage device to the video decoder. In particular for fast forward or backward play, only specific pictures or picture sequences are to be displayed. Due to the editing, the resulting data transferred to the video decoder will not necessarily have a valid TS or PES stream format, and the behavior of the video decoder may not necessarily be what is expected.
The goal of the invention is to send only legal (in the sense of the ISO 13818-2 standard) streams to the video decoder.
One object of the invention is a method for decoding a packetized data stream comprising packets, a packet comprising a header and a payload, an elementary stream being encapsulated as payload in the packets,
characterized in that it comprises the steps of:
selecting an object header in the elementary stream;
inserting a packetized data stream packet header before said object header;
transferring the inserted packet header, the object header and data of the packetized data stream consecutive to the object header to a packetized data stream parser.
By inserting an additional packet header before the header of the object to be parsed and decoded, the integrity of the elementary stream, as seen from the parser, is restored. Thus the parser will behave correctly.
According to a particular embodiment, the packetized data stream is a PES stream, the elementary stream an elementary video stream and the object header one of the following: a sequence header, a picture header, a group of picture header.
Another object of the invention is a method for decoding a transport stream encapsulating a packetized data stream comprising packets, a packet comprising a header and a payload, an elementary stream being encapsulated as payload in the packets,
characterized in that it comprises the steps of:
selecting an object header in the elementary stream;
inserting a transport stream packet before the transport stream packet containing the object header, said inserted transport stream packet comprising a packetized data stream header;
transferring the inserted transport stream packet followed by the transport stream packet containing the object header to a transport stream demultiplexer followed by a packetized data stream parser.
Constraints applying to TS streams are different from those applying to PES streams, as far as stream edition is concerned. In order to insert a PES packet header, a special TS packet has to be inserted, with the PES packet header contained as the TS packet""s payload.
According to a particular embodiment, the transport stream, the packetized data stream and the elementary stream are MPEG compliant, wherein the elementary stream is an elementary video stream, and wherein the object header is one of the following: a sequence header, a picture header, a group of picture header.
Another object of the invention is a digital video decoding device characterized in that it comprises:
a mass storage device for storing a digital video stream having packetized elementary stream format;
a video decoding circuit adapted to receive packetized elementary stream format data;
a circuit for locating an object header in an elementary video stream encapsulated in said digital video stream, for transferring to the decoder a part of the elementary stream starting from said object header and for inserting a dummy packetized elementary stream packet header in front of said object header before said transfer.
Another object of the invention is a digital video decoding device characterized in that it comprises:
a mass storage device storing a digital video stream having transport stream format;
a video decoding circuit adapted to receive transport stream format data;
a circuit for locating an object header in an elementary video stream encapsulated in said digital video stream, for transferring, to the decoder, the transport stream starting at the transport stream packet containing the elementary stream packet containing the object header and for inserting a transport stream packet before the transport stream packet containing the object header, said inserted transport stream packet comprising a packetized data stream header.